<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h1 @mouseenter="mouseEnter" @mouseleave="mouseLeave">888</h1>
        <button @click="toggle">click</button>
        <nh1 :show="isShow"></nh1>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        Vue.component('nh1',{
            props:{
                show: Boolean   //确定传入props的数据类型
            },
            template: '<h1>hello <button v-show="show">22</button></h1>'
        })

        var app = new Vue({
            el: "#app",
            data:{
                isShow: true
            },
            methods:{
                toggle: function(){
                    this.isShow = !this.isShow;
                },

                mouseEnter: function(){
                    this.isShow = true;
                },

                mouseLeave: function(){
                    this.isShow = false;
                }
            }
        })
    </script>
</body>
</html>